//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    height: app.globalData.height,
    width: app.globalData.width,
    barHeight: app.globalData.barHeight,
    serverUrl: app.globalData.serverUrl,
    item: []
  },
  //事件处理函数
  onLoad(options) {
    var item = JSON.parse(options.item)
    var images = item.paths;
    for (var index in images) {
      images[index] = this.data.serverUrl + images[index]
    }
    this.setData({
      item: item,
      images: images
    })
  },
  //返回
  back: function (e) {
    wx.navigateBack({
      delta: 1,
    })
  },
  handleImagePreview(e) {
    var idx = e.target.dataset.idx
    var images = this.data.images
    wx.previewImage({
      current: images[idx],  //当前预览的图片
      urls: images,  //所有要预览的图片
    })
  }
})
